<div class="pageContent">
	
	<form method="post" action="/index.php?act=price&st=price_add&price_id={$price_id}" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
		<div class="pageFormContent" layoutH="58">

			<div class="unit">
				<label>&nbsp;</label><label>&nbsp;&nbsp;&nbsp;字段名称设置</label><label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;排序</label><label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><label>操作</label>
			</div>

			<div class="unit">
				<label>一级字段：</label>
				<input name="price_name1" type="text" size="30" value="" class="required" errormsg="请输入一级字段"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="sort1" type="text" size="3" value="0"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="is_show" type="checkbox" value="1" checked>价格查询结果页展示
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="select_all" type="checkbox" value="1">复选
			</div>
			<div class="unit" tag="0">
				<label>&nbsp;&nbsp;&nbsp;&nbsp;二级字段：</label>
				<input name="price_name2[]" type="text" size="30" value="" class="required" errormsg="请输入二级字段"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="sort2[]" type="text" size="3" value="0"/>
				<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="add_third(this)">添加三级字段</button></div></div>
			</div>
			<div class="unit">
				<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三级字段：</label>
				<input name="price_name3[0][]" type="text" size="30" value="" errormsg="请输入三级字段"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input name="sort3[]" type="text" size="3" value="0"/>
				<span class="info"></span>
			</div>	
			<div class="unit">
				<label>&nbsp;&nbsp;</label>
				<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="add_second(this)">添加二级字段</button></div></div>
			</div><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
			<div class="unit">
				<span>* 展示顺序数字越小排序越靠前；</br>* 勾选前台展示后在前台到货价查询结果页会显示该字段</span>
			</div>
		</div>
		
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>

	</form>

</div>

<script type="text/javascript">
var currentIndex = 0;
function add_second(obj){
	var $html = '<label>&nbsp;&nbsp;&nbsp;&nbsp;二级字段：</label><input name="price_name2[]" type="text" size="30" value="" errormsg="请输入二级字段" class="textInput valid"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="sort2[]" type="text" size="3" value="0" class="textInput valid"/><div class="buttonActive"><div class="buttonContent"><button type="button" onclick="add_third(this)">添加三级字段</button></div></div>';
	currentIndex += 1;
	var $html = '<div class="unit" tag="' + currentIndex + '">' + $html + '</div>';
	$(obj).parent().parent().parent().before($html);
}
function add_third(obj){
	var index = currentIndex;
	var _obj = $(obj).parent().parent().parent();
	//var $html = _obj.next().html();
	var $tag = _obj.attr("tag");
	//if($html.indexOf("&nbsp;三级字段") == -1){
	var $html = '<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三级字段：</label><input name="price_name3[' + $tag + '][]" type="text" size="30" value="" errormsg="请输入三级字段" class="textInput valid"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="sort3[]" type="text" size="3" value="0" class="textInput valid"/><span class="info"></span>';
	//}
	$html = '<div class="unit">' + $html + '</div>';
	_obj.after($html);
}
</script>